|
|
|
|
|
|
|
A Select Case statement is used in place of multiple If...Then...ElseIf statements when youre testing the same condition over and over. Your code is more efficient and more readable when you use the Select Case construct than multiple If...Then...ElseIf statements. |
|
|
|
 |
|
|
|
|
Select Case <Expression>
Case <Expression List 1>
<Statement Block 1>
Case <Expression List 2>
<Statement Block 1>
Case Else
<Statement Block>
End Select |
|
|
|
|
|
|
|
|
Examples Filename: Employee2.frm |
|
|
|
 |
|
|
|
|
Private Sub cmdSave_Click()
If txtLast.Text = "" Then
MsgBox "Last Name Must Be Filled In"
End If
If optMale.Value = True Then
MsgBox "Employee is Male"
Else
MsgBox "Employee is Female"
End If Select Case cboState.Text
Case "CA" MsgBox "Employee can sign up for Health Care" Case "AZ" MsgBox "Employee is eligible for Bonus Programmer" Case "NV" MsgBox "Employee is eligible for 401k" End Select End Sub |
|
|
|
|
|